""" MultiGenerator module contains predefined generators and base implementation of MultiGenerator. """

from S3D.MultiGenerator.Generators import *
from S3D.AutoTagSearcher import Searcher, DefaultExtensions

__all__ = [
    "MultiGenerator",
    "MultiGeneratorConfig",
    "DescGenerator",
    "MacrosGenerator"
]

class MultiGeneratorConfig:
    def __init__(self):
        self.extensions = list(DefaultExtensions)
        self.searchPath = []
        self.excludePath = []
        self.macrosExtension = "macros"
        self.macrosSearchPath = []

class MultiGenerator:
    def __init__(self):
        self.searcher = Searcher()
        registerAll(self.searcher)
        self.extensions = list(DefaultExtensions)
        self.searchPath = []
        self.excludePath = []

    def execute(self, searchPath = None, excludePath = None, extensions = None):
        if searchPath == None:
            searchPath = self.searchPath
        if excludePath == None:
            excludePath = self.excludePath
        if extensions == None:
            extensions = self.extensions

        if not self.searcher.search(searchPath, excludePath, extensions):
            self.searcher.printErrorMsg()
            return False

        if not self.searcher.execute():
            self.searcher.printErrorMsg()
            return False

        return True
